<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
?>
<form method="get" action="<?=$_SERVER["PHP_SELF"];?>">
<input type="hidden" name="page" value="listroledef">
<select name="type" size=1 id="app_select">
        <?
	
        $aTypes=$RoleAdmin->GetRoleDefinitionTypes();
        for ($i=0; $i<count($aTypes); $i++)
        {
	    if ($aTypes[$i]==$_GET["type"])
	    {
		$s=" selected";
	    }
	    else
	    {
		$s="";
	    }
            ?>
            <option value="<?=$aTypes[$i];?>"<?=$s;?>><?=$aTypes[$i];?></option>
            <?
        }
	?>
</select>
<input type="submit" value="View Role Definitions" name="submit" id="app_submit" style="float: none">
</form>

<p><a href="<?=$_SERVER["PHP_SELF"];?>?page=addroledef">Add a New Role Definition</a></p>

<?
if ($_GET["type"]!="")
{
    ?>

<table border="0" cellpadding="0" cellspacing="0" class="app_table">
<tr class="app_mainrow">
    <td>
	<b>ID</b>
    </td>
    <td>
	<b>Name</b>
    </td>
    <td>
	<b>Description</b>
    </td>
    <td>
	<b>Code</b>
    </td>
    <td>
	<b>Options</b>
    </td>
</tr>

<?
$aResult=$RoleAdmin->GetRoleDefinitionsByType($_GET["type"]);

if (is_array($aResult))
{
    for ($i=0; $i<count($aResult);$i++)
    {
	?>
	<tr valign="top" class="app_row">
	    <td>
		<?=$aResult[$i]["ID"];?>
	    </td>
	    <td>
		<?=$aResult[$i]["name"];?>
	    </td>
	    <td>
		<?=$aResult[$i]["description"];?>
	    </td>
	    <td>
		<?=$aResult[$i]["code"];?>
	    </td>
	    <td>
		<a href="<?=$_SERVER["PHP_SELF"];?>?page=editroledef&ID=<?=$aResult[$i]["ID"];?>">Edit</a> |
		<a href="<?=$_SERVER["PHP_SELF"];?>?page=removeroledef&ID=<?=$aResult[$i]["ID"];?>&type=<?=$_GET["type"];?>" onclick="javascript: return confirm('Are you sure?');">Delete</a>
	    </td>
	</tr>
	<?
	
    }
    
}

?>

</table>

<?
}
?>




